VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MsComCtl.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmEnhanceRequisitionSlip 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   6300
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   13530
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   6300
   ScaleWidth      =   13530
   ShowInTaskbar   =   0   'False
   Begin ITGControls.ITGTab SSTab1 
      Height          =   5790
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   13395
      _ExtentX        =   23627
      _ExtentY        =   10213
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   2
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      Tab(0)ContCtrlCap(2)=   "ComunionFrames2"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483627
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   5355
         Left            =   -75000
         TabIndex        =   15
         Top             =   315
         Width           =   13275
         _ExtentX        =   23416
         _ExtentY        =   9446
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   6
         BeginProperty Column00 
            DataField       =   "cTranNo"
            Caption         =   "Requisition No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "dDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cType"
            Caption         =   "Type"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "DeptID"
            Caption         =   "Department"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "cEmpCode"
            Caption         =   "Requested by"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "cRemarks"
            Caption         =   "Remarks"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            AllowRowSizing  =   0   'False
            BeginProperty Column00 
               ColumnAllowSizing=   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1649.764
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   1454.74
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
               ColumnWidth     =   1200.189
            EndProperty
            BeginProperty Column03 
               Locked          =   -1  'True
               ColumnWidth     =   1679.811
            EndProperty
            BeginProperty Column04 
               Locked          =   -1  'True
            EndProperty
            BeginProperty Column05 
               Locked          =   -1  'True
               ColumnWidth     =   4965.166
            EndProperty
         EndProperty
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   2865
         Left            =   0
         Top             =   315
         Width           =   13395
         _ExtentX        =   23627
         _ExtentY        =   5054
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Supply Request Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.ComboBox cboType 
            Appearance      =   0  'Flat
            BackColor       =   &H00FFFFFF&
            Height          =   315
            ItemData        =   "frmEnhanceRequisitionSlip.frx":0000
            Left            =   7890
            List            =   "frmEnhanceRequisitionSlip.frx":0010
            Style           =   2  'Dropdown List
            TabIndex        =   3
            Top             =   465
            Width           =   1545
         End
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   3045
            Top             =   360
         End
         Begin VB.CommandButton cmdPickRefWONo 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   9105
            Picture         =   "frmEnhanceRequisitionSlip.frx":003C
            Style           =   1  'Graphical
            TabIndex        =   8
            Top             =   840
            Width           =   315
         End
         Begin VB.CommandButton cmdPickEmpCode 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   2595
            Picture         =   "frmEnhanceRequisitionSlip.frx":0186
            Style           =   1  'Graphical
            TabIndex        =   10
            Top             =   1140
            Width           =   315
         End
         Begin VB.CommandButton cmdPickDeptID 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   2595
            Picture         =   "frmEnhanceRequisitionSlip.frx":02D0
            Style           =   1  'Graphical
            TabIndex        =   5
            Top             =   825
            Width           =   315
         End
         Begin VB.CommandButton cmdIssue 
            Caption         =   "&Issue Requisition"
            Height          =   615
            Left            =   11340
            Picture         =   "frmEnhanceRequisitionSlip.frx":041A
            Style           =   1  'Graphical
            TabIndex        =   19
            TabStop         =   0   'False
            ToolTipText     =   "Serve Sales Order (Alt+S)"
            Top             =   2085
            Width           =   1590
         End
         Begin ITGControls.ITGTextBox txtTranNo 
            Height          =   285
            Left            =   135
            TabIndex        =   1
            Top             =   510
            Width           =   2445
            _ExtentX        =   4101
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Requisition No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1135
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtRemarks 
            Height          =   285
            Left            =   135
            TabIndex        =   16
            Top             =   1770
            Width           =   6315
            _ExtentX        =   10927
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Remarks"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   5005
         End
         Begin ITGControls.ITGDateBox dtbDate 
            Height          =   285
            Left            =   5160
            TabIndex        =   2
            Tag             =   "Transaction Date"
            Top             =   510
            Width           =   1305
            _ExtentX        =   2302
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtType 
            Height          =   285
            Left            =   7125
            TabIndex        =   22
            Tag             =   "cboType"
            Top             =   495
            Width           =   1935
            _ExtentX        =   3201
            _ExtentY        =   503
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   800
            TextBoxWidth    =   1075
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtEmpCode 
            Height          =   285
            Left            =   135
            TabIndex        =   9
            Top             =   1140
            Width           =   2430
            _ExtentX        =   4075
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Requested by"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1120
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtPosition 
            Height          =   285
            Left            =   135
            TabIndex        =   13
            TabStop         =   0   'False
            Top             =   1455
            Width           =   6315
            _ExtentX        =   10927
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "Position"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   5005
         End
         Begin ITGControls.ITGTextBox txtRefWONo 
            Height          =   285
            Left            =   6615
            TabIndex        =   7
            Top             =   825
            Width           =   2445
            _ExtentX        =   4101
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "Reference No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1135
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtEmpName 
            Height          =   285
            Left            =   2940
            TabIndex        =   11
            TabStop         =   0   'False
            Top             =   1140
            Width           =   3525
            _ExtentX        =   6112
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   3465
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtDeptID 
            Height          =   285
            Left            =   135
            TabIndex        =   4
            Top             =   825
            Width           =   2430
            _ExtentX        =   4075
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Department"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1120
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtDeptDesc 
            Height          =   285
            Left            =   2925
            TabIndex        =   6
            TabStop         =   0   'False
            Top             =   825
            Width           =   3525
            _ExtentX        =   6112
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   3465
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGDateBox dtbDateNeeded 
            Height          =   285
            Left            =   11685
            TabIndex        =   17
            Tag             =   "Transaction Date"
            Top             =   825
            Width           =   1305
            _ExtentX        =   2302
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGDateBox dtbDateReceived 
            Height          =   285
            Left            =   11685
            TabIndex        =   18
            Tag             =   "Transaction Date"
            Top             =   1140
            Width           =   1305
            _ExtentX        =   2302
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtApprovedBy 
            Height          =   285
            Left            =   6615
            TabIndex        =   14
            TabStop         =   0   'False
            Top             =   1455
            Width           =   6375
            _ExtentX        =   11033
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Locked          =   -1  'True
            Label           =   "Approved By"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   5065
         End
         Begin ITGControls.ITGDateBox dtbDateApproved 
            Height          =   285
            Left            =   7890
            TabIndex        =   12
            Tag             =   "Transaction Date"
            Top             =   1140
            Width           =   1305
            _ExtentX        =   2302
            _ExtentY        =   503
            BackColor       =   14737632
            Enabled         =   0   'False
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
            BackColor       =   14737632
         End
         Begin VB.Label Label5 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date Approved"
            Height          =   195
            Left            =   6630
            TabIndex        =   21
            Top             =   1185
            Width           =   1095
         End
         Begin VB.Label Label4 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date Received"
            Height          =   195
            Left            =   10410
            TabIndex        =   25
            Top             =   1200
            Width           =   1050
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date Needed"
            Height          =   195
            Left            =   10410
            TabIndex        =   24
            Top             =   885
            Width           =   945
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date"
            Height          =   195
            Left            =   4755
            TabIndex        =   23
            Top             =   555
            Width           =   345
         End
      End
      Begin ITGControls.ComunionFrames ComunionFrames2 
         Height          =   2625
         Left            =   0
         Top             =   3165
         Width           =   13395
         _ExtentX        =   23627
         _ExtentY        =   4630
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Details"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.ComboBox cboRSType 
            Height          =   315
            ItemData        =   "frmEnhanceRequisitionSlip.frx":0884
            Left            =   135
            List            =   "frmEnhanceRequisitionSlip.frx":088E
            Style           =   2  'Dropdown List
            TabIndex        =   27
            Top             =   1770
            Visible         =   0   'False
            Width           =   1035
         End
         Begin VB.ComboBox cboRS 
            Height          =   315
            ItemData        =   "frmEnhanceRequisitionSlip.frx":08A1
            Left            =   90
            List            =   "frmEnhanceRequisitionSlip.frx":08B4
            Style           =   2  'Dropdown List
            TabIndex        =   26
            Top             =   2115
            Visible         =   0   'False
            Width           =   1035
         End
         Begin MSDataGridLib.DataGrid dtgRS 
            Height          =   2205
            Left            =   0
            TabIndex        =   28
            Top             =   420
            Width           =   13395
            _ExtentX        =   23627
            _ExtentY        =   3889
            _Version        =   393216
            AllowUpdate     =   -1  'True
            AllowArrows     =   -1  'True
            BackColor       =   16777215
            HeadLines       =   1
            RowHeight       =   15
            TabAcrossSplits =   -1  'True
            TabAction       =   2
            FormatLocked    =   -1  'True
            AllowDelete     =   -1  'True
            BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            ColumnCount     =   10
            BeginProperty Column00 
               DataField       =   "cType"
               Caption         =   "Type"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column01 
               DataField       =   "cItemType"
               Caption         =   "Item Type"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column02 
               DataField       =   "cItemNo"
               Caption         =   "Product ID"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   "0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column03 
               DataField       =   "cDesc"
               Caption         =   "Description"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column04 
               DataField       =   "cUnit"
               Caption         =   "Unit"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column05 
               DataField       =   "nQty"
               Caption         =   "Quantity"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   1
                  Format          =   "#,##0.00"
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   1
               EndProperty
            EndProperty
            BeginProperty Column06 
               DataField       =   "cStatus"
               Caption         =   "Status"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column07 
               DataField       =   "cRemarks"
               Caption         =   "Remarks"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column08 
               DataField       =   "cRefWRRNo"
               Caption         =   "Reference No."
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            BeginProperty Column09 
               DataField       =   "cBarcodeID"
               Caption         =   "Barcode ID"
               BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
                  Type            =   0
                  Format          =   ""
                  HaveTrueFalseNull=   0
                  FirstDayOfWeek  =   0
                  FirstWeekOfYear =   0
                  LCID            =   1033
                  SubFormatType   =   0
               EndProperty
            EndProperty
            SplitCount      =   1
            BeginProperty Split0 
               BeginProperty Column00 
                  Button          =   -1  'True
                  Locked          =   -1  'True
                  ColumnWidth     =   975.118
               EndProperty
               BeginProperty Column01 
                  Button          =   -1  'True
                  Locked          =   -1  'True
                  ColumnWidth     =   1110.047
               EndProperty
               BeginProperty Column02 
                  Button          =   -1  'True
                  ColumnWidth     =   1409.953
               EndProperty
               BeginProperty Column03 
                  Locked          =   -1  'True
                  ColumnWidth     =   2610.142
               EndProperty
               BeginProperty Column04 
                  Locked          =   -1  'True
                  ColumnWidth     =   675.213
               EndProperty
               BeginProperty Column05 
                  Alignment       =   1
                  ColumnWidth     =   1019.906
               EndProperty
               BeginProperty Column06 
                  Locked          =   -1  'True
                  ColumnWidth     =   1124.787
               EndProperty
               BeginProperty Column07 
                  ColumnWidth     =   2429.858
               EndProperty
               BeginProperty Column08 
                  Locked          =   -1  'True
               EndProperty
               BeginProperty Column09 
                  Locked          =   -1  'True
                  ColumnWidth     =   1289.764
               EndProperty
            EndProperty
         End
      End
   End
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   20
      Top             =   6015
      Width           =   13530
      _ExtentX        =   23865
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   10638
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
End
Attribute VB_Name = "frmEnhanceRequisitionSlip"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'IT Group Inc. 2005.09.23

Option Explicit

'Object variables





'Recordset variables
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsDetail As ADODB.Recordset
Private rsAuto As ADODB.Recordset

'ADO Connection variables

Private connHeader As ADODB.Connection
Private connDetail As ADODB.Connection

'Form mode enumeration
Enum eReqSlipMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eReqSlipMode

'Auto Numbering
Public lSystemGeneratedSO As Boolean
Private strNo As String
Private sAuto As String

'Other declarations
Public dtgName As String
Public sBit As String
Private vBM As Variant 'Recordset bookmark variable

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

'Private Sub cboAssetType_Click()
'    txtAssetType = Trim(cboAssetType)
'    If Mode <> AddNewEdit Then Exit Sub
'    txtAssetID = Empty
'    txtVehicleKM = Empty
'    EnableFATabs
'End Sub
'
'Private Sub cboAssetType_KeyPress(KeyAscii As Integer)
'    SendKeysTab KeyAscii
'End Sub
'
'Private Sub cboRS_Click()
'    rsDetail!cItemType = cboRS
'End Sub

Private Sub cboRS_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If dtgRS.Col = 1 Then
            rsDetail!cItemType = cboRS
            cboRS.Visible = False
            dtgRS.Col = 2
            dtgRS.SetFocus
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboRS.Visible = False
    End If
End Sub

Private Sub cboRSType_LostFocus()
    cboRSType.Visible = False
End Sub

Private Sub cboRSType_Click()
    rsDetail!cType = cboRSType
End Sub

Private Sub cboRSType_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If dtgRS.Col = 0 Then
            rsDetail!cType = cboRSType
            cboRSType.Visible = False
            dtgRS.Col = 1
            dtgRS.SetFocus
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboRSType.Visible = False
    End If
End Sub

Private Sub cboRS_LostFocus()
    cboRS.Visible = False
End Sub

Private Sub cboType_Click()
    txtType = Trim(cboType)
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(cboType) = "Stocking" Then
        txtRefWONo.TabStop = False
        cmdPickRefWONo.TabStop = False
        txtRefWONo.Locked = True
        txtRefWONo = ""
        cmdPickRefWONo.Enabled = False
        
'        cboAssetType.Enabled = True
'        txtAssetID.Locked = False
'        txtAssetID.TabStop = True
'        cmdPickAssetID.Enabled = True
    Else
        txtRefWONo.TabStop = True
        cmdPickRefWONo.TabStop = True
        txtRefWONo.Locked = True
        txtRefWONo = ""
        cmdPickRefWONo.Enabled = True
        
'        cboAssetType.Enabled = False
'        txtAssetID.Locked = True
'        txtAssetID.TabStop = False
'        cmdPickAssetID.Enabled = False
    End If
    'ClearFADetails
    ClearDataGrid
    ClearOtherInfo
End Sub

Private Sub cboType_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cmdIssue_Click()
On Error GoTo ErrorHandler
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Cancelled transaction cannot be served.", vbExclamation, "ComUnion"
        Exit Sub
    ElseIf rsHeader!lServed = True Then
        MsgBox "Transaction already Served.", vbExclamation, "ComUnion"
        Exit Sub
    End If
        
    
    If MsgBox("Are you sure you want to issue this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub

    cn.Execute ("UPDATE REQUISITIONSLIP_T SET lIssued = 1 WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    cn.Execute ("UPDATE REQUISITIONSLIP     SET lIssued = 1 WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    'Audit trail
    UpdateLogFile "Requisition Slip", Trim(txtTranNo), "Issued"

    sbRS.Panels(5) = "ISSUED"
    Mode = Normal
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

'Private Sub cmdPickAssetID_Click()
'    If Trim(txtAssetType) = "" Then
'        MsgBox "Please choose 'Asset Type' first.", vbExclamation, "ComUnion"
'        txtAssetID = Empty
'        cboAssetType.SetFocus
'        Exit Sub
'    End If
''    If lPickListActive Then Exit Sub
''    cStrTypeHdr = " (" & Trim(cboAssetType) & ")"
''    cStrType = " AND cType = '" & Trim(cboAssetType) & "' "
''    frmITGPickList.mType = Asset
''    frmITGPickList.Show vbModal
''    rsHeader!cAssetNo = frmITGPickList.mCode
''    txtAssetDesc = frmITGPickList.mName
''    If Trim(txtAssetDesc) <> "" And Trim(cboAssetType) = "Vehicle" Then SendKeys "{Tab}"
''    cStrTypeHdr = Empty
''    cStrType = Empty
''    SendKeys "{Tab}"
'    If lPickListActive Then Exit Sub
'    sFilterString = Trim(txtDeptID)
'    If Trim(cboAssetType) = "Vehicle" Then
'        frmITGPicker.zType = QFixedAssetVehicle
'        frmITGPicker.Show vbModal
'        txtDeptID = frmITGPicker.zCode
'        txtDeptDesc = frmITGPicker.zName
'    ElseIf Trim(cboAssetType) = "Vessel" Then
'        frmITGPicker.zType = QFixedAssetVessel
'        frmITGPicker.Show vbModal
'        txtDeptID = frmITGPicker.zCode
'        txtDeptDesc = frmITGPicker.zName
'    ElseIf Trim(cboAssetType) = "Equipment" Then
'        frmITGPicker.zType = QFixedAssetEquipment
'        frmITGPicker.Show vbModal
'        txtDeptID = frmITGPicker.zCode
'        txtDeptDesc = frmITGPicker.zName
'    ElseIf Trim(cboAssetType) = "Others" Then
'        frmITGPicker.zType = QFixedAssetOthers
'        frmITGPicker.Show vbModal
'        txtDeptID = frmITGPicker.zCode
'        txtDeptDesc = frmITGPicker.zName
'    End If
'    If Trim(txtDeptDesc) <> "" Then SendKeys "{Tab}"
'
'End Sub

Private Sub cmdPickDeptID_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtDeptID)
    frmITGPicker.zType = QSecDepartment
    frmITGPicker.Show vbModal
    txtDeptID = frmITGPicker.zCode
    txtDeptDesc = frmITGPicker.zName
    If Trim(txtDeptDesc) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub cmdPickEmpCode_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtEmpCode)
    frmITGPicker.zType = QEmployee
    frmITGPicker.Show vbModal
    txtEmpCode = frmITGPicker.zCode
    txtEmpName = frmITGPicker.zName
    If Trim(txtEmpName) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub cmdPickRefWONo_Click()
    If Mode <> AddNewEdit Then Exit Sub
    
    If Trim(cboType) = "" Then
        MsgBox "Please select transaction type.", vbInformation, "ComUnion"
        cboType.SetFocus
        Exit Sub
    End If
    
    If Trim(cboType) = "Stocking" Then Exit Sub
    
    cString = Trim(cboType)
    frmARDRList.mDRType = WOForRequest
    frmARDRList.Show vbModal
    
    If Trim(txtRefWONo) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

Private Sub dtgRS_AfterColUpdate(ByVal ColIndex As Integer)
    
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 2
            If dtgRS.Columns(0).Text <> "Existing" Then Exit Sub
            If dtgRS.Columns(1).Text = "" Then Exit Sub
            If Trim(dtgRS.Columns(1).Text) = "Trade" Then
                If GetValueFrTable("cItemNo", "ITEM", "cItemNo = '" & Trim(dtgRS.Columns(2).Value) & "'") <> "" Then
                    GetInitialItemValues rsDetail
                    dtgRS.Col = 5
                    dtgRS.Columns(5).Value = rsDetail!nQty
                End If
            ElseIf Trim(dtgRS.Columns(1).Text) = "Asset" Then
                If GetValueFrTable("cAssetNo", "ASSET", "cAssetNo = '" & Trim(dtgRS.Columns(2).Value) & "'") <> "" Then
                    GetInitialAssetValues rsDetail
                    dtgRS.Col = 5
                    dtgRS.Columns(5).Value = 0
                End If
            ElseIf Trim(dtgRS.Columns(1).Text) = "Supply" Then
                If GetValueFrTable("cSupplyNo", "SUPPLY", "cSupplyNo = '" & Trim(dtgRS.Columns(2).Value) & "'") <> "" Then
                    GetInitialSupplyValues rsDetail
                    dtgRS.Col = 5
                    dtgRS.Columns(5).Value = 0
                End If

            End If
        Case 5
            If Trim(dtgRS.Columns(1).Text) = "Trade" Then
                ReCheckItemStatus
'            Else
'                dtgRS.Columns(6).Value = "No Stock"
            End If
    End Select
    
End Sub

Private Sub dtgRS_ButtonClick(ByVal ColIndex As Integer)

    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            Call MoveCombo(cboRSType, dtgRS, dtgRS.Columns(0))
            ComboLoadValue cboRSType, Trim(dtgRS.Columns(0).Text)
        Case 1
            Call MoveCombo(cboRS, dtgRS, dtgRS.Columns(1))
            ComboLoadValue cboRS, Trim(dtgRS.Columns(1).Text)
        Case 2
            If dtgRS.Columns(0).Text <> "Existing" Then Exit Sub
            If dtgRS.Columns(1).Text = "" Then Exit Sub
            If dtgRS.Columns(1).Text = "Trade" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(dtgRS.Columns(2).Text)
                frmITGPicker.zType = QProduct
                'frmITGPicker.sPCCode = sDivision
                frmITGPicker.Show vbModal
                rsDetail!cItemNo = Trim(frmITGPicker.zCode) & "" 'GetValueFrTable("cItemNo", "ITEM", "cPartNo = '" & Trim(frmITGPicker.zCode) & "'")
                rsDetail!cDesc = Trim(frmITGPicker.zName) & ""
                rsDetail!cBarcodeID = Trim(frmITGPicker.zPart) & ""
                If (Trim(frmITGPicker.zName) & "") <> "" Then
                    dtgRS.Col = 3
                    GetInitialItemValues rsDetail
                    dtgRS.Col = 5
                    dtgRS.Columns(5).Value = rsDetail!nQty
                End If
            ElseIf dtgRS.Columns(1).Text = "Asset" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(dtgRS.Columns(2).Text)
                frmITGPicker.zType = QFixedAsset
                'frmITGPicker.sPCCode = sDivision
                frmITGPicker.Show vbModal
                rsDetail!cItemNo = Trim(frmITGPicker.zCode) & ""
                If (Trim(frmITGPicker.zName) & "") <> "" Then
                    GetInitialAssetValues rsDetail
                    dtgRS.Col = 5
                    dtgRS.Columns(5).Value = 0
                End If
            ElseIf dtgRS.Columns(1).Text = "Supply" Then
                If lPickListActive Then Exit Sub
                sFilterString = Trim(dtgRS.Columns(2).Text)
                frmITGPicker.zType = QSupply
                'frmITGPicker.sPCCode = sDivision
                frmITGPicker.Show vbModal
                rsDetail!cItemNo = Trim(frmITGPicker.zCode) & ""
                rsDetail!cDesc = Trim(frmITGPicker.zName) & ""
                If (Trim(frmITGPicker.zName) & "") <> "" Then
                    GetInitialSupplyValues rsDetail
                    dtgRS.Col = 5
                    dtgRS.Columns(5).Value = 0
                End If
            End If
    End Select

End Sub

'Set the datagrid as active control
Private Sub dtgRS_Click()
    If Mode = AddNewEdit Then dtgName = dtgRS.Name
End Sub

Private Sub dtgRS_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgRS_GotFocus()
    dtgName = dtgRS.Name
End Sub

Private Sub dtgRS_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgRS_KeyPress(KeyAscii As Integer)
    
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then Exit Sub
    
    If KeyAscii = 39 Then KeyAscii = 0 'Apostrophe {'}
    
    If KeyAscii = 13 Then
        Select Case dtgRS.Col
            Case 0
                If Not cboRSType.Visible Then dtgRS_ButtonClick (0)
            Case 1
                If Not cboRS.Visible Then dtgRS_ButtonClick (1)
            Case 2
                If dtgRS.Columns(0).Text <> "Existing" Then Exit Sub
                If dtgRS.Columns(1).Text = "" Then Exit Sub
                If rsDetail!cType <> "New" Then
                    If dtgRS.Columns(1).Text = "Trade" Then
                        If GetValueFrTable("cItemNo", "ITEM", "cItemNo = '" & Trim(dtgRS.Columns(2).Value) & "'") = "" Then
                            If Trim(dtgRS.Columns(1).Text) = "Trade" Then dtgRS_ButtonClick (2)                      'use button click
                        End If
                    ElseIf dtgRS.Columns(1).Text = "Asset" Then
                        If GetValueFrTable("cAssetNo", "ASSET", "cAssetNo = '" & Trim(dtgRS.Columns(2).Value) & "'") = "" Then
                            If Trim(dtgRS.Columns(1).Text) = "Asset" Then dtgRS_ButtonClick (2)                      'use button click
                        End If
                    ElseIf dtgRS.Columns(1).Text = "Supply" Then
                        If GetValueFrTable("cSupplyNo", "SUPPLY", "cSupplyNo = '" & Trim(dtgRS.Columns(2).Value) & "'") = "" Then
                            If Trim(dtgRS.Columns(1).Text) = "Supply" Then dtgRS_ButtonClick (2)                      'use button click
                        End If
                    End If
                Else
                    SendKeys "{Tab}"
                End If
            Case 5
                SendKeys "{Tab}"
                SendKeys "{Tab}"
            Case 7
                TBNewLine
                dtgRS.LeftCol = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
    End If

End Sub

'Right click menu popup
Private Sub dtgRS_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgRS.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgRS_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
On Error Resume Next
    If Mode <> AddNewEdit Then Exit Sub
    
    If Trim(dtgRS.Columns(0).Text) = "New" Then
        dtgRS.Columns(3).Locked = False
        dtgRS.Columns(4).Locked = False
    Else
        dtgRS.Columns(3).Locked = True
        dtgRS.Columns(4).Locked = True
    End If
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

'Set Your Object
Private Sub Form_Load()

    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'SC06'")
    
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset
    

    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True

    Mode = Find
    txtTranNo.Locked = False

End Sub

'Activate your Toolbar Mode
Private Sub Form_Activate()
    TBBitReload
End Sub

'Release your Object
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False

    
    
    
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set connHeader = Nothing
    Set connDetail = Nothing
    Set rsAuto = Nothing
    
    Set frmEnhanceRequisitionSlip = Nothing

    lCloseWindow = True
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

'Add new record to the recordset
Public Sub TBNew()

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtTranNo.BackColor = &HE0FFFF
    Mode = AddNewEdit

    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenNewConnection connDetail
        OpenRecordsetWithCN rsDetail, "*", "REQUISITIONSLIP_T", connDetail, "WHERE 1 = 0"
        OpenRecordsetWithCN rsHeader, "*", "REQUISITIONSLIP", connHeader, "WHERE 1 = 0"
        SetDataSource
        SetDataField
    Else
        vBM = rsHeader.Bookmark
    End If

    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!dDate = Date
    
'    SSTab2.TabEnabled(0) = True
'    SSTab2.TabEnabled(1) = False
'    SSTab2.TabEnabled(2) = False
'    SSTab2.TabEnabled(3) = False
'
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    SSTab1.ActiveTab = 0
'    SSTab2.ActiveTab = 0
    rsHeader!cType = "Stocking"
    txtTranNo.SetFocus
    
End Sub

'Undo all changes to the recordset
Public Sub TBUndoAll()
On Error GoTo ErrorHandler

    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    rsDetail.CancelBatch adAffectAll
    
    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , lACPost, , , , True, True, , True
    Else
        RSZero
        Mode = Find
    End If

    sbRS.Panels(2) = ""
    
    SetDataSource
    SetDataField

ErrorHandler:

    cboRS.Visible = False
    
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoAll
    End If

End Sub

'Undo changes on the current record
Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    GetChild
    If rsHeader.Status = adRecNew Then
        rsDetail.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsDetail.CancelBatch adAffectAll
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then 'Operation was cancelled. (Error returned by ITGDateBox)
        TBUndoCurrent
    End If

End Sub

'Save all changes
Public Sub TBSave()
Dim OKUpdate As Boolean
On Error GoTo ErrHandler

    'Audit Trail
    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True
    
    If Not MandatoryOK Then Exit Sub
    
    If rsHeader.Status = adRecNew Then
    
    End If
    
'
'    rsHeader!lApproved = IIf(rsHeader!cType = "Stocking", 1, 0)
'    rsHeader!dApproved = IIf(rsHeader!cType = "Stocking", Now, Null)
'    rsHeader!cApproved = IIf(rsHeader!cType = "Stocking", SecUserID, 0)
    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    connDetail.BeginTrans
        
    rsHeader.UpdateBatch adAffectAll
    rsDetail.UpdateBatch adAffectAll
    
    cn.CommitTrans
    connHeader.CommitTrans
    connDetail.CommitTrans
    OKUpdate = True
    
    
    Set FrmName = Me
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , lACPost, , , , True, True, , True
    Mode = Normal
    
    MsgBox "Record/s successfully saved.", vbInformation, "ComUnion"
    sbRS.Panels(2) = ""
    
    'Audit trail
    UpdateLogFile "Requisition Slip", Trim(txtTranNo), IIf(lBoolean, "Inserted", "Updated")

ErrHandler:
    cboRS.Visible = False
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, "ComUnion"
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsDetail.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, "ComUnion"
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name 'Error log
    End If
    
End Sub

'Sets the form & recorset to add/edit mode
Public Sub TBEdit()
    If rsHeader!lCancelled Then
        MsgBox "Cancelled Requisition Slip cannot be edited.", vbInformation, "ComUnion"
        Exit Sub
    ElseIf rsHeader!lIssued Or rsDetail!lIssued Then
        MsgBox "Issued Requisition Slip cannot be edited.", vbInformation, "ComUnion"
        Exit Sub
    ElseIf rsHeader!lApproved And rsHeader!cType <> "Stocking" Then
        MsgBox "Approved Requisition Slip cannot be edited.", vbInformation, "ComUnion"
        Exit Sub
    ElseIf GetValueFrTable("cRefNo", "Supplyissuance_T", "cRefNo = '" & Trim(rsHeader!cTranNo) & "'") <> "" Then
        MsgBox "Requisition Slip with Issuance cannot be edited.", vbInformation, "ComUnion"
        Exit Sub
    ElseIf GetValueFrTable("cRefNo", "Requisition", "cType = 'From RS' and cRefNo = '" & Trim(rsHeader!cTranNo) & "'") <> "" Then
        MsgBox "Requisition Slip with Purchase Requisition cannot be edited.", vbInformation, "ComUnion"
        Exit Sub
    End If
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    txtRefWONo.Locked = True
    ClrRequired &HC0&
    cmdPickRefWONo.Enabled = False
    txtTranNo.Locked = True
    SSTab1.ActiveTab = 0
    dtbDate.SetFocus
    vBM = rsHeader.Bookmark
'    EnableFATabs
End Sub

'Delete record
Public Sub TBDelete()
On Error GoTo ErrorHandler

    sID = Trim(txtTranNo)
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub

    GetChild
    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.RecordCount = 0
            rsDetail.Delete adAffectCurrent
            If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
        Loop
    End If
    
    'Audit trail
    UpdateLogFile "Requisition Slip", Trim(txtTranNo), "Deleted"

    'Update GL Activity
    'UpdateGLA "Delete", "POC", Trim(txtTranNo)
    
    rsHeader.Delete adAffectCurrent
    
    rsDetail.UpdateBatch adAffectAll
    rsHeader.UpdateBatch adAffectAll
    
    TBPrevRec

    Mode = Normal

    If rsHeader.RecordCount = 0 Then
        RSZero
    End If

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        cn.Execute "DELETE REQUISITIONSLIP_T WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE REQUISITIONSLIP WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
    End If

End Sub

'Search using the frmITGSearch
Public Sub TBFind()
    Mode = Normal
    txtTranNo.Locked = True
    frmITGSearch.Show 'vbModal
End Sub

'Search using the recordset primary key
Public Sub TBFindPrimary()
Dim sTemp As String
If Mode = Find Then
    FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
        
    OpenNewConnection connHeader
    OpenNewConnection connDetail
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset

    sTemp = Trim$(GetSearchString)
    If sTemp = "ERROR" Then
        MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
        txtTranNo.Locked = False
        txtTranNo.SetFocus
        Exit Sub
    End If
    
    
    
    If GetValueFrTable("lBit", "SYSTEM_OPTION", "cCode = 'ITM_VER_ALLSPLYREQ'") = True Then
        If GetValueFrTable("RoleID", "SEC_USER", "UserID = '" & sUserName & "'", True) = GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'ITM_VER_ALLSPLYREQ'") _
            Or SecUserRole = "CEO" Or SecUserRole = "ADMIN" Or SecUserRole = "SUPERUSER" Then
            OpenRecordsetWithCN rsHeader, "*", "REQUISITIONSLIP", connHeader, IIf(sTemp = "", "", " WHERE " & sTemp), True
            OpenRecordsetWithCN rsDetail, "*", "REQUISITIONSLIP_T", connDetail, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM REQUISITIONSLIP WHERE " & sTemp & ")"), True
        End If
    Else
        OpenRecordsetWithCN rsHeader, "*", "REQUISITIONSLIP", connHeader, IIf(sTemp = "", "", " WHERE " & sTemp)
        'OpenRecordsetWithCN rsDetail, "*", "REQUISITIONSLIP_T", connDetail
        OpenRecordsetWithCN rsDetail, "*", "REQUISITIONSLIP_T", connDetail, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM REQUISITIONSLIP WHERE " & sTemp & ")")
    End If
    
    
    Set FrmName = Me
    FormLocking True

       If rsHeader.RecordCount = 0 Then
        FormWaitHide
        MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
        Exit Sub
    End If
    SetDataSource
    SetDataField
    txtTranNo.BackColor = &HE0FFFF
    Mode = Normal
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , lACPost, , , , True, True, , True
    BitVisible ITGLedgerMain.tbrMain, True, True
    FormWaitHide
Else
    RSZero
    FormSearch True
    SearchObj True
    Mode = Find
   
End If

End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
    dtgName = dtgRS.Name
End Sub

'Close active window
Public Sub TBCloseWindow()
    Unload Me
End Sub

'Move first
Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader
    
End Sub

'Move previuos
Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader
    
End Sub

'Move next
Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader
    
End Sub

'Move last
Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader

End Sub

'Add new line to the detail recordset
Public Sub TBNewLine()
    
    If rsHeader!cTranNo = "" Then Exit Sub
    
    If dtgName = "dtgRS" Then
        rsDetail.AddNew
        rsDetail!cCompanyID = COID
        rsDetail!cTranNo = Trim(rsHeader!cTranNo)
        dtgRS.Col = 0
        dtgRS.Columns(0).Value = ""
        GetChild
        If rsDetail.RecordCount <> 0 Then rsDetail.MoveLast
        dtgRS.SetFocus
    End If
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

End Sub

'Delete line in the detail recordset
Public Sub TBDeleteLine()
On Error GoTo ErrorHandler

    If dtgName = dtgRS.Name Then
        If rsDetail.RecordCount = 0 Then Exit Sub
        vBookMark = dtgRS.Bookmark
        GetChild
        dtgRS.Bookmark = vBookMark
        rsDetail.Delete adAffectCurrent
    End If
    GetChild

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Undo All
Public Sub TBUndoLineAll()
On Error GoTo ErrorHandler

    MsgBox "Unavailable on " & Me.Name

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Undo current line
Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Post current record
Public Sub TBPostRecord()
'    MsgBox "Unavailable on " & Me.Name
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Approval is not allowed", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    If rsHeader!lApproved = True Then
        MsgBox "Transaction was already approved.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    If rsHeader!cType = "Stocking" Then
        MsgBox "Stocking type has no approval.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to approve this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub

    'Audit trail
    UpdateLogFile "Requisition Slip ", Trim(txtTranNo), "Approved"
    
    rsHeader!lApproved = True
    rsHeader.UpdateBatch adAffectAll
    
    sbRS.Panels(5) = "APPROVED"
    Mode = Normal
    
    

TheSource:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

'Cancel current record
Public Sub TBCancelRecord()
On Error GoTo ErrorHandler
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to cancel this record?", vbQuestion + vbYesNo, "ComUnion") = vbNo Then Exit Sub

    'CANCELLATION CONSTRAINT
    'If Not AllowDelete("cancel") Then Exit Sub
    
    'Audit trail
    UpdateLogFile "Requisition Slip", Trim(txtTranNo), "Cancelled"

    cn.Execute ("UPDATE REQUISITIONSLIP SET lCancelled = 1 WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    
    sbRS.Panels(5) = "CANCELLED"
    Mode = Normal
    
    rsHeader!lCancelled = True
    rsHeader.UpdateBatch adAffectAll

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

'Print
Public Sub TBPrintRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

'Sets the data source of the controls
Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgList.DataSource = rsHeader
    Set dtgRS.DataSource = rsDetail
    
End Sub

'Sets the data field for every bounded controls
Sub SetDataField()
    With rsHeader
        txtTranNo.DataField = !cTranNo
        dtbDate.DataField = !dDate
        txtType.DataField = !cType
        dtbDateNeeded.DataField = !dNeeded
        dtbDateReceived.DataField = !dReceived
        txtDeptID.DataField = !DeptID
        txtEmpCode.DataField = !cEmpCode
        txtRemarks.DataField = !cRemarks
        txtRefWONo.DataField = !cRefWONo
'        txtAssetType.DataField = !cAssetType
'        txtAssetID.DataField = !cAssetNo
'        txtVehicleKM.DataField = !nVehicleKM
        txtApprovedBy.DataField = !cApproved
        dtbDateApproved.DataField = !dApproved
    End With
End Sub

Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler

    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        'Status bar setup
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount

        If rsHeader.Status <> adRecNew Then
            txtTranNo.Locked = True
        Else
            txtTranNo.Locked = False
        End If

        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else
            sbRS.Panels(2) = ""
'            If Trim(rsHeader!cAssetType) = "Equipment" Then
'                SSTab2.ActiveTab = 0
'            ElseIf Trim(rsHeader!cAssetType) = "Vehicle" Then
'                SSTab2.ActiveTab = 1
'            ElseIf Trim(rsHeader!cAssetType) = "Vessel" Then
'                SSTab2.ActiveTab = 2
'            ElseIf Trim(rsHeader!cAssetType) = "Others" Then
'                SSTab2.ActiveTab = 3
'            Else
'                SSTab2.ActiveTab = 0
'            End If
        End If
        
        GetChild
        
        If rsHeader!lCancelled = True Then
            sbRS.Panels(5) = "CANCELLED"
        ElseIf rsHeader!lIssued = True Then
            sbRS.Panels(5) = "ISSUED"
        ElseIf rsHeader!lApproved Then
            sbRS.Panels(5) = "APPROVED"
        Else
            sbRS.Panels(5) = ""
        End If
    
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtTranNo.Locked = False
    End If

    If Mode = AddNewEdit Then
        dtgRS.Refresh
    End If

ErrorHandler:
    'Err.Number -2147217885
    'Description - Row handle referred to a deleted row or a row marked for deletion.
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab1.TabEnabled(1) = False
        cmdIssue.Enabled = True
    Else
        SSTab1.TabEnabled(1) = True
        SSTab_Normal
        cmdIssue.Enabled = True
    End If
End Sub



'Private Sub txtAssetID_Change()
'    txtAssetDesc = ""
'    txtAssetDesc = GetValueFrTable("cDesc", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'    ClearFADetails
'    If Trim(txtAssetDesc) <> "" Then
'        If Trim(cboAssetType) = "Equipment" Then
'            txtCategory = GetValueFrTable("cCategory", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'            txtMarks = GetValueFrTable("cMark", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'            txtLocation = GetValueFrTable("cLocation", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'        ElseIf Trim(cboAssetType) = "Vehicle" Then
'            txtVehicleType = GetValueFrTable("cVehicleType", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'            txtVehicleMake = GetValueFrTable("cVehicleMake", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'            txtVehicleModel = GetValueFrTable("cVehicleModel", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'            txtVehicleDesc = GetValueFrTable("cVehicleDesc", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'            txtVehiclePlateNo = GetValueFrTable("cVehiclePlateNo", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'        ElseIf Trim(cboAssetType) = "Vessel" Then
'            txtVesselNo = GetValueFrTable("cVesselNo", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'            txtVesselName = GetValueFrTable("cVesselName", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'            txtVesselEngine = GetValueFrTable("cVesselEngine", "ASSET", "cAssetNo = '" & Trim(txtAssetID) & "'")
'        ElseIf Trim(cboAssetType) = "Others" Then
'        End If
'    End If
'End Sub
'
'Private Sub txtAssetID_LostFocus()
'    If Mode <> AddNewEdit Then Exit Sub
'    If Trim(txtAssetDesc) = "" And Trim(txtAssetID) <> "" Then cmdPickAssetID_Click
'    If Trim(cboAssetType) = "Vehicle" Then Exit Sub
'    If rsDetail.RecordCount < 1 Then TBNewLine
'End Sub

Private Sub txtDeptID_Change()
    txtDeptDesc = ""
    txtDeptDesc = GetValueFrTable("Description", "SEC_DEPARTMENT", "DeptID = '" & Trim(txtDeptID) & "'", True)
End Sub

Private Sub txtDeptID_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtDeptDesc) = "" And Trim(txtDeptID) <> "" Then cmdPickDeptID_Click
End Sub

Private Sub txtEmpCode_Change()
    txtEmpName = ""
    txtPosition = ""
    txtEmpName = GetValueFrTable("cEmpName", "EMPLOYEE", "cEmpCode = '" & Trim(txtEmpCode) & "'")
    If Trim(txtEmpName) <> "" Then
        txtPosition = GetValueFrTable("cEmpType", "EMPLOYEE", "cEmpCode = '" & Trim(txtEmpCode) & "'")
    End If
End Sub

Private Sub txtEmpCode_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtEmpName) = "" And Trim(txtEmpCode) <> "" Then cmdPickEmpCode_Click
End Sub

Private Sub txtTranNo_LostFocus()
    'Does Code Already Exist
    If Mode = AddNewEdit Then
        If Trim(txtTranNo) = "" Then
            MsgBox "Empty primary input.", vbInformation, "ComUnion"
            If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
            txtTranNo.SetFocus
        Else
            If rsHeader.Status <> adRecNew Then Exit Sub
            txtTranNo = Trim(txtTranNo)
            If IDExisting(rsHeader, "cTranNo", "REQUISITIONSLIP", Trim(rsHeader!cTranNo)) Then
                MsgBox "Requisition No. already exist.", vbInformation, "ComUnion"
                If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
                txtTranNo.SetFocus
            End If
        End If
    End If
End Sub

'Check if all mandatory fields are complete
Function MandatoryOK() As Boolean

    MandatoryOK = True

    If Trim(txtTranNo) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Number' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        txtTranNo.SetFocus
        Exit Function
    End If
    
    If rsHeader.Status = adRecNew Then
        If IDExisting(rsHeader, "cTranNo", "REQUISITIONSLIP", Trim(rsHeader!cTranNo)) Then
            MandatoryOK = False
            MsgBox "Transaction No. already exist.", vbInformation, "ComUnion"
            txtTranNo.SetFocus
            Exit Function
        End If
    End If

    'Required fields
    If Trim(dtbDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        dtbDate.SetFocus
        Exit Function
    ElseIf Trim(txtType) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Type' is mandatory. Null value is not allowed.", vbInformation, "ComUnion"
        cboType.SetFocus
        Exit Function
    End If
    
    GetChild
    
    'Transaction without details
    If rsDetail.RecordCount = 0 Then
        MandatoryOK = False
        MsgBox "Cannot save transaction without details.", vbInformation, "ComUnion"
        dtgRS.SetFocus
        Exit Function
    End If
    
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
    Do Until rsDetail.EOF
        If rsDetail.Status = (adRecNew) Or rsDetail.Status = (adRecModified) Then
            If IsNull(rsDetail!cItemNo) Then
                rsDetail.Delete
            ElseIf Trim(rsDetail!cItemNo) = "" Then
                rsDetail.Delete
            Else
                rsDetail.MoveNext
            End If
        Else
            rsDetail.MoveNext
        End If
    Loop

    GetChild

    If rsDetail.RecordCount < 1 Then
        MsgBox "Cannot save transaction without details.", vbExclamation, "ComUnion"
        MandatoryOK = False
        Exit Function
    End If

End Function

'Filter detail recordset to header's primary
Private Sub GetChild()
    rsDetail.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
End Sub

'Sets the form if record number is zero
Private Sub RSZero()
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    sbRS.Panels(4) = ""
    sbRS.Panels(5) = ""
    
    Set dtgRS.DataSource = Nothing
    dtgRS.Refresh
    
    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    
    If rsHeader.State = adStateOpen Then rsHeader.Close
    If rsDetail.State = adStateOpen Then rsDetail.Close
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
    txtTranNo.Locked = False
    txtTranNo.SetFocus
    
    Mode = Find
    
End Sub

Sub SearchObj(lEnable As Boolean)
    dtbDate.Enabled = lEnable
    cboType.Enabled = lEnable
    cmdPickDeptID.Enabled = lEnable
    cmdPickEmpCode.Enabled = lEnable
End Sub

'Private Sub txtAssetType_Change()
'    If Trim(txtAssetType) <> "" Or txtAssetType <> vbNullString Then
'        cboAssetType = Trim(txtAssetType)
'    Else
'        cboAssetType.ListIndex = -1
'    End If
'End Sub

'Private Sub ClearFADetails()
'    txtCategory = Empty
'    txtMarks = Empty
'    txtLocation = Empty
'    txtVehicleType = Empty
'    txtVehicleMake = Empty
'    txtVehicleModel = Empty
'    txtVehicleDesc = Empty
'    txtVehiclePlateNo = Empty
'    txtVesselNo = Empty
'    txtVesselName = Empty
'    txtVesselEngine = Empty
'End Sub
'
'Private Sub EnableFATabs()
'    If Trim(cboAssetType) = "Equipment" Then
'        SSTab2.ActiveTab = 0
'        SSTab2.TabEnabled(0) = True
'        SSTab2.TabEnabled(1) = False
'        SSTab2.TabEnabled(2) = False
'        SSTab2.TabEnabled(3) = False
'    ElseIf Trim(cboAssetType) = "Vehicle" Then
'        SSTab2.ActiveTab = 1
'        SSTab2.TabEnabled(0) = False
'        SSTab2.TabEnabled(1) = True
'        SSTab2.TabEnabled(2) = False
'        SSTab2.TabEnabled(3) = False
'    ElseIf Trim(cboAssetType) = "Vessel" Then
'        SSTab2.ActiveTab = 2
'        SSTab2.TabEnabled(0) = False
'        SSTab2.TabEnabled(1) = False
'        SSTab2.TabEnabled(2) = True
'        SSTab2.TabEnabled(3) = False
'    ElseIf Trim(cboAssetType) = "Others" Then
'        SSTab2.ActiveTab = 3
'        SSTab2.TabEnabled(0) = False
'        SSTab2.TabEnabled(1) = False
'        SSTab2.TabEnabled(2) = False
'        SSTab2.TabEnabled(3) = True
'    ElseIf Trim(cboAssetType) = "Others" Then
'        SSTab2.ActiveTab = 0
'        SSTab2.TabEnabled(0) = True
'        SSTab2.TabEnabled(1) = False
'        SSTab2.TabEnabled(2) = False
'        SSTab2.TabEnabled(3) = False
'    End If
'End Sub

Private Sub txtType_Change()
Dim sCode As String

    If Trim(txtType) <> "" Or txtType <> vbNullString Then
        cboType = Trim(txtType)
    Else: cboType.ListIndex = -1
    End If
    
    If Mode = AddNewEdit Then
        If rsHeader.Status = adRecNew Then
            Set rsAuto = Nothing
            Set rsAuto = New ADODB.Recordset
                Select Case Trim(cboType)
                    Case "Stocking"
                        sCode = "RS_AUTO_ST"
                    Case "Repair"
                        sCode = "RS_AUTO_RE"
                    Case "Maintenance"
                        sCode = "RS_AUTO_MA"
                    Case Else

                End Select
                
                sSQL = "select * from SYSTEM_OPTION where cCode = '" & sCode & "' and cCompanyID = '" & COID & "'"
                rsAuto.Open sSQL, cn, adOpenKeyset, adLockReadOnly
                
                If rsAuto.RecordCount <> 0 Then
                    If rsAuto!lBit Then
                        GetCtrlNo rsAuto!cCode
                    End If
                End If
            End If
        End If
        
        'txtType = ""
        
End Sub

'Gets initital item values
Private Sub GetInitialItemValues(RefRS As Recordset)
    RefRS!cItemType = "Trade"
'    RefRS!cDesc = Trim(GetValueFrTable("cDesc", "ITEM", "cItemNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
    RefRS!cUnit = Trim(GetValueFrTable("cUnit", "ITEM", "cItemNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
    CheckItemStatus
End Sub

'Gets initital asset values
Private Sub GetInitialAssetValues(RefRS As Recordset)
    RefRS!cItemType = "Asset"
    RefRS!cDesc = Trim(GetValueFrTable("cDesc", "ASSET", "cAssetNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
    RefRS!cUnit = "Unit" 'Trim(GetValueFrTable("cUnit", "ITEM", "cItemNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
    RefRS!cStatus = "Available"
End Sub

'Gets initital asset values
Private Sub GetInitialSupplyValues(RefRS As Recordset)
    RefRS!cItemType = "Supply"
'    RefRS!cDesc = Trim(GetValueFrTable("cDesc", "SUPPLY", "cSupplyNo = '" & Trim(RefRS!cItemNo) & "'")) & ""
    RefRS!cUnit = Trim(GetValueFrTable("cUnit", "SUPPLY", "cSupplyNo = '" & Trim(RefRS!cItemNo) & "'", True)) & ""
    RefRS!cStatus = "Available"
End Sub

Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtTranNo.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cTranno LIKE '" & Trim$(txtTranNo.Text) & "%'"
    End If

    If Trim$(dtbDate.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dDate = '" & Trim$(dtbDate.Text) & "'"
    End If
    
    If Trim$(txtType.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cType LIKE '" & Trim$(txtType.Text) & "%'"
    End If
    
    If Trim$(txtDeptID.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " DeptID LIKE '" & Trim$(txtDeptID.Text) & "%'"
    End If
    
    If Trim$(txtEmpCode.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cEmpCode LIKE '" & Trim$(txtEmpCode.Text) & "%'"
    End If
    
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

Private Sub CheckItemStatus()
    If rsDetail!cType = "New" Then
        rsDetail!cStatus = "No Stock"
    Else
        Dim rsBal As New ADODB.Recordset
        If GetValueFrTable("lBit", "SYSTEM_OPTION", "cCode = 'ITM_MAN_USEPARTNO'") = False Then
            ProductBalanceCommand rsBal, rsDetail!cItemNo
        Else
            sSQL = "exec sp_ProductBalanceInquiry_ModuleWPartNo '" & rsDetail!cItemNo & "', '" & rsDetail!cBarcodeID & "', '" & COID & "'"
            rsBal.Open sSQL, cn, adOpenStatic, adLockOptimistic
        End If
        
        If rsBal.RecordCount > 0 Then
            If rsBal!nBalance <= 0 Then
                rsDetail!cStatus = "No Stock"
                rsDetail!nQty = 0
            Else
                rsDetail!cStatus = "Available"
                rsDetail!nQty = rsBal!nBalance - rsBal!nReserved
            End If
        Else
            rsDetail!cStatus = "Available"
            rsDetail!nQty = 0
        End If
        rsBal.Close
        Set rsBal = Nothing
    End If
End Sub

Private Sub SSTab_Normal()
'    SSTab2.TabEnabled(0) = True
'    SSTab2.TabEnabled(1) = True
'    SSTab2.TabEnabled(2) = True
'    SSTab2.TabEnabled(3) = Truesss
End Sub

'Form list to grid
Public Sub AddDetailsFromList()
    
    GetChild
    
    With frmARDRList.lvwList
        For i = 1 To .ListItems.Count
            If .ListItems(i).Checked = True Then
                rsDetail.AddNew
                rsDetail!cCompanyID = COID
                rsDetail!cTranNo = Trim(rsHeader!cTranNo)
                rsHeader!cRefWONo = Trim(frmARDRList.mRefPK)
                rsDetail!cItemNo = Trim(.ListItems(i).Text)
                rsDetail!cDesc = Trim(.ListItems(i).SubItems(1))
                rsDetail!cUnit = Trim(.ListItems(i).SubItems(3))
                rsDetail!nQty = CDbl(.ListItems(i).SubItems(4))
                rsDetail!nRefIdentity = CDbl(.ListItems(i).SubItems(7))
                rsDetail!cType = "Existing"
                rsDetail!cItemType = GetValueFrTable("cItemType", "WO_PARTS", "cTranNo = '" & rsHeader!cRefWONo & "' AND nIdentity = " & rsDetail!nRefIdentity & " ")
                ReCheckItemStatus
                Dim sJONo As String
                sJONo = GetValueFrTable("cRefJONo", "WO", "cTranNo = '" & rsHeader!cRefWONo & "' ")
                rsHeader!cAssetType = GetValueFrTable("cAssetType", "JO", "cTranNo = '" & sJONo & "' ")
                rsHeader!cAssetNo = GetValueFrTable("cAssetNo", "JO", "cTranNo = '" & sJONo & "' ")
             End If
        Next i
    End With

    GetChild

End Sub

Private Sub ReCheckItemStatus()
    If rsDetail!cType = "New" Then
        rsDetail!cStatus = "No Stock"
    Else
        Dim nQty As Double
        nQty = rsDetail!nQty
        CheckItemStatus
        If nQty > rsDetail!nQty Then
            rsDetail!cStatus = "No Stock"
        Else
            rsDetail!cStatus = "Available"
        End If
        rsDetail!nQty = nQty
    End If
End Sub

Private Sub txtVehicleKM_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount < 1 Then TBNewLine
End Sub

'Clear Data Grid
Private Sub ClearDataGrid()
    GetChild
    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.RecordCount = 0
            rsDetail.Delete adAffectCurrent
            If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
        Loop
    End If
    GetChild
End Sub

Private Sub ClearOtherInfo()
    txtDeptID = Empty
    txtEmpCode = Empty
    txtRemarks = Empty
'    txtAssetType = Empty
'    txtAssetID = Empty
End Sub

Public Sub ShowTran()
    If Mode = Find Then

        OpenNewConnection connHeader
        OpenNewConnection connDetail

        Set rsHeader = Nothing
        Set rsDetail = Nothing
        Set rsHeader = New ADODB.Recordset
        Set rsDetail = New ADODB.Recordset

        OpenRecordsetWithCN rsDetail, "*", "REQUISITIONSLIP_T", connDetail, "WHERE cTranNo = '" & Trim(txtTranNo) & "'", True
        OpenRecordsetWithCN rsHeader, "*", "REQUISITIONSLIP", connHeader, "WHERE cTranNo = '" & Trim(txtTranNo) & "'", True

        Set FrmName = Me
        FormLocking True

        If rsHeader.RecordCount = 0 Then
            FormWaitHide
            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
            RSZero
            FormSearch True
            SearchObj True
            Mode = Find
            Exit Sub
        End If
            SetDataSource
            SetDataField
            txtTranNo.BackColor = &HE0FFFF
            Mode = Normal
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , True, , , , True, , , True
'            oBar.BitEnabled Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True, True

    End If
End Sub


Function DuplicateRequest() As Boolean
    DuplicateRequest = False
End Function

Private Sub GetCtrlNo(sCode As String)
Dim lCtrlNoOK As Boolean

    strNo = rsAuto!cValue
    Do Until lCtrlNoOK
        If IDExisting(rsHeader, "cTranNo", "RequisitionSlip", Left(strNo, 5) + Format(CStr((CInt(Right(strNo, 4)) + 1)), "0000")) Then
            strNo = Left(strNo, 5) + Format(CStr((CInt(Right(strNo, 4)) + 1)), "0000")
        Else
            lCtrlNoOK = True
        End If
    Loop
    
    If Mid(strNo, 4, 2) <> Format(Date, "yy") Then
        txtTranNo = Format(1, "0000")
        strNo = Left(strNo, 3) + Format(Date, "yy") + "0000"
    Else
        txtTranNo = Left(strNo, 3) + Format(Date, "yy") + Format(Right(strNo, 4) + 1, "0000")
    End If
End Sub

'Check system generated number before saving
Function CheckCtrlNo() As Boolean

Dim lCtrlNoOK As Boolean
Dim strNewNo As String
Dim strNewRSNo As String
Dim sTrap

On Error GoTo TheSource

    CheckCtrlNo = False
    
    If IDExisting(rsHeader, "cTranNo", "RequisitionSlip", rsHeader!cTranNo) Then
        sTrap = Left(txtTranNo, 5) & (Format(Right(txtTranNo, 4) - 1, "0000"))
        
        strNewNo = Trim(GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = '" & rsAuto!cCode & "' "))
        
        Do Until lCtrlNoOK
            If IDExisting(rsHeader, "cTranNo", "RequisitionSlip", Left(strNewNo, 5) + Format(CStr((CInt(Right(strNewNo, 4)) + 1)), "0000")) Then
                strNewNo = Left(strNewNo, 5) + Format(CStr((CInt(Right(strNewNo, 4)) + 1)), "0000")
            Else
                lCtrlNoOK = True
            End If
        Loop
        
        If Mid(strNewNo, 4, 2) <> Format(Date, "yy") Then
            strNewRSNo = Format(1, "0000")
            strNewNo = Left(rsAuto!cValue, 3) + Format(Date, "yy") + "0000"
        Else
            strNewRSNo = Left(rsAuto!cValue, 3) + Format(Date, "yy") + Format(Right(strNewNo, 4) + 1, "0000")
        End If
        
        GetChild
        
        rsHeader!cTranNo = strNewRSNo
        If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
        Do Until rsDetail.EOF
            rsDetail!cTranNo = strNewRSNo
            rsDetail.MoveNext
        Loop
        
        GetChild
        
        strNo = strNewNo
    End If
    
    CheckCtrlNo = True
    
TheSource:
    If Not CheckCtrlNo Then
        If MsgBox("Record cannot be updated. Transaction number already exists. " & vbCr & _
                "Current transaction number may have been used by other user/s since last read." & vbCr & _
                "Do you want to assign another number?", vbYesNo + vbInformation, "ComUnion") = vbYes Then
            frmChangeTranNo.mType = Change_SONo
            frmChangeTranNo.Show vbModal
        Else
            MsgBox "Transaction will be undone.", vbInformation, "ComUnion"
            TBUndoAll
        End If
    End If
End Function



